/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package telas;

import aplicacaoPlano.AplicacaoPlano;
import aplicacaoPlano.AplicacaoPlanoDAO;
import cartao.Cartao;
import cartao.CartaoDAO;
import java.awt.Color;
import java.util.List;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

/**
 *
 * @author Max Weber
 */
public class O18TelaCadastrarCartao extends javax.swing.JFrame {

    /**
     * Creates new form O10TelaConsultarVacinas
     */
    public O18TelaCadastrarCartao() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        bgEntrou = new javax.swing.JLabel();
        bgSaiu = new javax.swing.JLabel();
        btPainelModelo = new javax.swing.JPanel();
        icon = new javax.swing.JLabel();
        bt = new javax.swing.JLabel();
        grSexo = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        painelFechar = new javax.swing.JPanel();
        btFechar = new javax.swing.JLabel();
        btMaxi = new javax.swing.JLabel();
        btMini = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        jTabbedPane2 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        tfNome_resp = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        tfCPF_resp = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        tfNome_dono = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        tfData_dono = new javax.swing.JTextField();
        jrMasculino = new javax.swing.JRadioButton();
        jrFeminino = new javax.swing.JRadioButton();
        jLabel8 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        tfLogradouro = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        tfNumero = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        tfComplemento = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        tfBairro = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        tfCep = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        tfCidade = new javax.swing.JTextField();
        jcEstado = new javax.swing.JComboBox();
        jLabel15 = new javax.swing.JLabel();
        btCadastrar = new javax.swing.JPanel();
        iconCadastrar = new javax.swing.JLabel();
        tfCadastrar = new javax.swing.JLabel();
        btCancelar = new javax.swing.JPanel();
        iconCancelar = new javax.swing.JLabel();
        tfCancelar = new javax.swing.JLabel();

        bgEntrou.setBackground(new java.awt.Color(68, 165, 237));
        bgEntrou.setText("jLabel4");

        bgSaiu.setBackground(new java.awt.Color(10, 66, 108));
        bgSaiu.setText("jLabel4");

        btPainelModelo.setBackground(new java.awt.Color(10, 66, 108));
        btPainelModelo.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btPainelModeloMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                btPainelModeloMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                btPainelModeloMouseExited(evt);
            }
        });
        btPainelModelo.setLayout(new java.awt.GridBagLayout());

        icon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/excluir2.png"))); // NOI18N
        icon.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                iconMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                iconMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                iconMouseExited(evt);
            }
        });
        btPainelModelo.add(icon, new java.awt.GridBagConstraints());

        bt.setFont(new java.awt.Font("Arial", 1, 16)); // NOI18N
        bt.setForeground(new java.awt.Color(255, 255, 255));
        bt.setText("  Excluir");
        bt.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                btMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                btMouseExited(evt);
            }
        });
        btPainelModelo.add(bt, new java.awt.GridBagConstraints());

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setUndecorated(true);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel1.setBackground(new java.awt.Color(0, 114, 180));
        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/icone_barraDeTit.png"))); // NOI18N

        painelFechar.setBackground(new java.awt.Color(128, 128, 128));
        painelFechar.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                painelFecharMouseMoved(evt);
            }
        });
        painelFechar.addMouseWheelListener(new java.awt.event.MouseWheelListener() {
            public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
                painelFecharMouseWheelMoved(evt);
            }
        });
        painelFechar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                painelFecharMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                painelFecharMouseExited(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                painelFecharMousePressed(evt);
            }
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                painelFecharMouseReleased(evt);
            }
        });

        btFechar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/fechar.png"))); // NOI18N
        btFechar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btFecharMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                btFecharMouseEntered(evt);
            }
        });

        javax.swing.GroupLayout painelFecharLayout = new javax.swing.GroupLayout(painelFechar);
        painelFechar.setLayout(painelFecharLayout);
        painelFecharLayout.setHorizontalGroup(
            painelFecharLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelFecharLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btFechar)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        painelFecharLayout.setVerticalGroup(
            painelFecharLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelFecharLayout.createSequentialGroup()
                .addGap(3, 3, 3)
                .addComponent(btFechar)
                .addGap(3, 3, 3))
        );

        btMaxi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/maximizar.png"))); // NOI18N

        btMini.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/minimizar.png"))); // NOI18N

        jLabel2.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 18)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Cadastrar Cartão de Vacina");

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/vacinapeq.png"))); // NOI18N

        jPanel6.setBackground(new java.awt.Color(255, 255, 255));

        jTabbedPane2.setBackground(new java.awt.Color(247, 247, 247));
        jTabbedPane2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153)));
        jTabbedPane2.setFont(new java.awt.Font("Verdana", 0, 12)); // NOI18N

        jPanel2.setBackground(new java.awt.Color(247, 247, 247));
        jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel4.setBackground(new java.awt.Color(247, 247, 247));
        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Dados do Responsável", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Verdana", 0, 10), new java.awt.Color(153, 153, 153))); // NOI18N
        jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel4.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel4.setText("Nome:");
        jPanel4.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, -1, -1));

        tfNome_resp.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        tfNome_resp.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        tfNome_resp.setMargin(new java.awt.Insets(2, 10, 2, 2));
        tfNome_resp.setPreferredSize(new java.awt.Dimension(10, 21));
        jPanel4.add(tfNome_resp, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 50, 360, 30));

        jLabel5.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel5.setText("CPF:");
        jPanel4.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 20, -1, -1));

        tfCPF_resp.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        tfCPF_resp.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        tfCPF_resp.setMargin(new java.awt.Insets(10, 10, 10, 10));
        tfCPF_resp.setPreferredSize(new java.awt.Dimension(10, 21));
        jPanel4.add(tfCPF_resp, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 50, 220, 30));

        jPanel2.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 10, 650, 100));

        jPanel5.setBackground(new java.awt.Color(247, 247, 247));
        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Dados do Dono do Cartão", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Verdana", 0, 10), new java.awt.Color(153, 153, 153))); // NOI18N
        jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel6.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel6.setText("Nome:");
        jPanel5.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, -1, -1));

        tfNome_dono.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        tfNome_dono.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        tfNome_dono.setMargin(new java.awt.Insets(10, 10, 10, 10));
        tfNome_dono.setPreferredSize(new java.awt.Dimension(10, 21));
        jPanel5.add(tfNome_dono, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 50, 360, 30));

        jLabel7.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel7.setText("Data de nascimento:");
        jPanel5.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 20, -1, -1));

        tfData_dono.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        tfData_dono.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        tfData_dono.setMargin(new java.awt.Insets(10, 10, 10, 10));
        tfData_dono.setPreferredSize(new java.awt.Dimension(10, 21));
        jPanel5.add(tfData_dono, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 50, 220, 30));

        jrMasculino.setBackground(new java.awt.Color(247, 247, 247));
        grSexo.add(jrMasculino);
        jrMasculino.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        jrMasculino.setText("Masculino");
        jPanel5.add(jrMasculino, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 120, -1, -1));

        jrFeminino.setBackground(new java.awt.Color(247, 247, 247));
        grSexo.add(jrFeminino);
        jrFeminino.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        jrFeminino.setText("Feminino");
        jPanel5.add(jrFeminino, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 120, -1, -1));

        jLabel8.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel8.setText("Sexo:");
        jPanel5.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 90, -1, -1));

        jPanel2.add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 120, 650, 160));

        jTabbedPane2.addTab("Dados pessoais", jPanel2);

        jPanel3.setBackground(new java.awt.Color(247, 247, 247));
        jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel9.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel9.setText("Logradouro:");
        jPanel3.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 30, -1, -1));

        tfLogradouro.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        tfLogradouro.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        jPanel3.add(tfLogradouro, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 60, 420, 30));

        jLabel10.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel10.setText("Número:");
        jPanel3.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 30, -1, -1));

        tfNumero.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        tfNumero.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        jPanel3.add(tfNumero, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 60, 190, 30));

        jLabel11.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel11.setText("Complemento:");
        jPanel3.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 110, -1, -1));

        tfComplemento.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        tfComplemento.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        jPanel3.add(tfComplemento, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 140, 240, 30));

        jLabel12.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel12.setText("Bairro:");
        jPanel3.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 110, -1, -1));

        tfBairro.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        tfBairro.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        jPanel3.add(tfBairro, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 140, 160, 30));

        jLabel13.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel13.setText("CEP:");
        jPanel3.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 110, -1, -1));

        tfCep.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        tfCep.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        jPanel3.add(tfCep, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 140, 190, 30));

        jLabel14.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel14.setText("Cidade:");
        jPanel3.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 190, -1, -1));

        tfCidade.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        tfCidade.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        jPanel3.add(tfCidade, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 220, 200, 30));

        jcEstado.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        jcEstado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-- Selecione --", "AC", "AL", "AP", "AM", "BA", "CE", "DF", "ES", "GO", "MA", "MT", "MS", "MG", "PA", "PB", "PR", "PE", "PI", "RJ", "RN", "RS", "RO", "RR", "SC", "SP", "SE", "TO" }));
        jPanel3.add(jcEstado, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 220, 160, 30));

        jLabel15.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel15.setText("Estado:");
        jPanel3.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 190, -1, -1));

        jTabbedPane2.addTab("Endereço", jPanel3);

        btCadastrar.setBackground(new java.awt.Color(10, 66, 108));
        btCadastrar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btCadastrarMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                btCadastrarMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                btCadastrarMouseExited(evt);
            }
        });
        btCadastrar.setLayout(new java.awt.GridBagLayout());

        iconCadastrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Check-32.png"))); // NOI18N
        iconCadastrar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                iconCadastrarMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                iconCadastrarMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                iconCadastrarMouseExited(evt);
            }
        });
        btCadastrar.add(iconCadastrar, new java.awt.GridBagConstraints());

        tfCadastrar.setFont(new java.awt.Font("Arial", 1, 16)); // NOI18N
        tfCadastrar.setForeground(new java.awt.Color(255, 255, 255));
        tfCadastrar.setText(" Cadastrar");
        tfCadastrar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tfCadastrarMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                tfCadastrarMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                tfCadastrarMouseExited(evt);
            }
        });
        btCadastrar.add(tfCadastrar, new java.awt.GridBagConstraints());

        btCancelar.setBackground(new java.awt.Color(10, 66, 108));
        btCancelar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btCancelarMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                btCancelarMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                btCancelarMouseExited(evt);
            }
        });
        btCancelar.setLayout(new java.awt.GridBagLayout());

        iconCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Delete-32.png"))); // NOI18N
        iconCancelar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                iconCancelarMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                iconCancelarMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                iconCancelarMouseExited(evt);
            }
        });
        btCancelar.add(iconCancelar, new java.awt.GridBagConstraints());

        tfCancelar.setFont(new java.awt.Font("Arial", 1, 16)); // NOI18N
        tfCancelar.setForeground(new java.awt.Color(255, 255, 255));
        tfCancelar.setText("  Cancelar");
        tfCancelar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tfCancelarMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                tfCancelarMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                tfCancelarMouseExited(evt);
            }
        });
        btCancelar.add(tfCancelar, new java.awt.GridBagConstraints());

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 692, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20)
                .addComponent(btCadastrar, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addComponent(jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btCadastrar, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 17, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGap(3, 3, 3)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel2)
                        .addGap(131, 131, 131)
                        .addComponent(btMini)
                        .addGap(5, 5, 5)
                        .addComponent(btMaxi)
                        .addGap(5, 5, 5)
                        .addComponent(painelFechar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(3, 3, 3))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(3, 3, 3)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(painelFechar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2)
                        .addComponent(jLabel1)
                        .addComponent(jLabel3))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btMaxi)
                            .addComponent(btMini))
                        .addGap(5, 5, 5)))
                .addGap(3, 3, 3)
                .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(3, 3, 3))
        );

        getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 700, 430));

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void painelFecharMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_painelFecharMouseReleased

    }//GEN-LAST:event_painelFecharMouseReleased

    private void painelFecharMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_painelFecharMousePressed
        //painelFechar.setBackground(Color.red);
    }//GEN-LAST:event_painelFecharMousePressed

    private void painelFecharMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_painelFecharMouseExited
        // TODO add your handling code here:
        painelFechar.setBackground(Color.gray);

    }//GEN-LAST:event_painelFecharMouseExited

    private void painelFecharMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_painelFecharMouseEntered
        // TODO add your handling code here:
        painelFechar.setBackground(Color.red);
    }//GEN-LAST:event_painelFecharMouseEntered

    private void bgEntra(JPanel painel){
        painel.setBackground(bgEntrou.getBackground());
    }
    
    private void bgSai(JPanel painel){
        painel.setBackground(bgSaiu.getBackground());
    }
    
    private void painelFecharMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {//GEN-FIRST:event_painelFecharMouseWheelMoved

    }//GEN-LAST:event_painelFecharMouseWheelMoved

    private void painelFecharMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_painelFecharMouseMoved

    }//GEN-LAST:event_painelFecharMouseMoved

    private void btFecharMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btFecharMouseEntered
        painelFechar.setBackground(Color.red);
    }//GEN-LAST:event_btFecharMouseEntered

    private void btFecharMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btFecharMouseClicked
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_btFecharMouseClicked

    private void iconMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconMouseClicked
        // TODO add your handling code here:

    }//GEN-LAST:event_iconMouseClicked

    private void iconMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconMouseEntered
        bgEntra(btPainelModelo);
    }//GEN-LAST:event_iconMouseEntered

    private void iconMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconMouseExited
        bgSai(btPainelModelo);
    }//GEN-LAST:event_iconMouseExited

    private void btMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btMouseClicked
       
    }//GEN-LAST:event_btMouseClicked

    private void btMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btMouseEntered
        bgEntra(btPainelModelo);
    }//GEN-LAST:event_btMouseEntered

    private void btMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btMouseExited
        bgSai(btPainelModelo);
    }//GEN-LAST:event_btMouseExited

    private void btPainelModeloMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btPainelModeloMouseClicked
        // TODO add your handling code here:

    }//GEN-LAST:event_btPainelModeloMouseClicked

    private void btPainelModeloMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btPainelModeloMouseEntered
        // TODO add your handling code here:
        bgEntra(btPainelModelo);
    }//GEN-LAST:event_btPainelModeloMouseEntered

    private void btPainelModeloMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btPainelModeloMouseExited
        bgSai(btPainelModelo);
    }//GEN-LAST:event_btPainelModeloMouseExited

    private void iconCadastrarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconCadastrarMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_iconCadastrarMouseClicked

    private void iconCadastrarMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconCadastrarMouseEntered
        bgEntra(btCadastrar);
    }//GEN-LAST:event_iconCadastrarMouseEntered

    private void iconCadastrarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconCadastrarMouseExited
        bgSai(btCadastrar);
    }//GEN-LAST:event_iconCadastrarMouseExited

    private void tfCadastrarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tfCadastrarMouseClicked
        salvaInformacoes();
        
        
        
    }//GEN-LAST:event_tfCadastrarMouseClicked

    public void salvaInformacoes(){
        Cartao cartao = new Cartao();
        cartao.setNome_responsavel(tfNome_resp.getText());
        cartao.setCpf_responsavel(tfCPF_resp.getText());
        cartao.setNome_dono(tfNome_dono.getText());
        cartao.setData_nasc_dono(tfData_dono.getText());
        if(jrMasculino.isSelected()){
            cartao.setSexo_dono(jrMasculino.getText());
        } else {
            cartao.setSexo_dono(jrFeminino.getText());
        }
        cartao.setNumero(tfNumero.getText());
        cartao.setComplemento(tfComplemento.getText());
        cartao.setBairro(tfBairro.getText());
        cartao.setCep(tfCep.getText());
        cartao.setCidade(tfCidade.getText());
        cartao.setEstado(jcEstado.getSelectedItem().toString());
        
        CartaoDAO dao = new CartaoDAO();
        dao.adicionar(cartao);
        JOptionPane.showMessageDialog(rootPane, "Cartão cadastrado com sucesso!");

        
        limparCampos();
        dispose();
        O20TelaNotificacoes tela = new O20TelaNotificacoes(cartao);
        tela.setVisible(true);
    }
    
    private void tfCadastrarMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tfCadastrarMouseEntered
        bgEntra(btCadastrar);
    }//GEN-LAST:event_tfCadastrarMouseEntered

    private void tfCadastrarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tfCadastrarMouseExited
        bgSai(btCadastrar);
    }//GEN-LAST:event_tfCadastrarMouseExited

    private void btCadastrarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btCadastrarMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_btCadastrarMouseClicked

    private void btCadastrarMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btCadastrarMouseEntered
        // TODO add your handling code here:
        bgEntra(btCadastrar);
    }//GEN-LAST:event_btCadastrarMouseEntered

    private void btCadastrarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btCadastrarMouseExited
        bgSai(btCadastrar);
    }//GEN-LAST:event_btCadastrarMouseExited

    private void iconCancelarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconCancelarMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_iconCancelarMouseClicked

    private void iconCancelarMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconCancelarMouseEntered
        // TODO add your handling code here:
        bgEntra(btCancelar);
    }//GEN-LAST:event_iconCancelarMouseEntered

    private void iconCancelarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconCancelarMouseExited
        // TODO add your handling code here:
        bgSai(btCancelar);
    }//GEN-LAST:event_iconCancelarMouseExited

    private void tfCancelarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tfCancelarMouseClicked
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_tfCancelarMouseClicked

    private void tfCancelarMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tfCancelarMouseEntered
        // TODO add your handling code here:
        bgEntra(btCancelar);
    }//GEN-LAST:event_tfCancelarMouseEntered

    private void tfCancelarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tfCancelarMouseExited
        // TODO add your handling code here:
        bgSai(btCancelar);
    }//GEN-LAST:event_tfCancelarMouseExited

    private void btCancelarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btCancelarMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_btCancelarMouseClicked

    private void btCancelarMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btCancelarMouseEntered
        // TODO add your handling code here:
        bgEntra(btCancelar);
    }//GEN-LAST:event_btCancelarMouseEntered

    private void btCancelarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btCancelarMouseExited
        // TODO add your handling code here:
        bgSai(btCancelar);
    }//GEN-LAST:event_btCancelarMouseExited

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(O18TelaCadastrarCartao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(O18TelaCadastrarCartao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(O18TelaCadastrarCartao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(O18TelaCadastrarCartao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new O18TelaCadastrarCartao().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel bgEntrou;
    private javax.swing.JLabel bgSaiu;
    private javax.swing.JLabel bt;
    private javax.swing.JPanel btCadastrar;
    private javax.swing.JPanel btCancelar;
    private javax.swing.JLabel btFechar;
    private javax.swing.JLabel btMaxi;
    private javax.swing.JLabel btMini;
    private javax.swing.JPanel btPainelModelo;
    private javax.swing.ButtonGroup grSexo;
    private javax.swing.JLabel icon;
    private javax.swing.JLabel iconCadastrar;
    private javax.swing.JLabel iconCancelar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JTabbedPane jTabbedPane2;
    private javax.swing.JComboBox jcEstado;
    private javax.swing.JRadioButton jrFeminino;
    private javax.swing.JRadioButton jrMasculino;
    private javax.swing.JPanel painelFechar;
    private javax.swing.JTextField tfBairro;
    private javax.swing.JTextField tfCPF_resp;
    private javax.swing.JLabel tfCadastrar;
    private javax.swing.JLabel tfCancelar;
    private javax.swing.JTextField tfCep;
    private javax.swing.JTextField tfCidade;
    private javax.swing.JTextField tfComplemento;
    private javax.swing.JTextField tfData_dono;
    private javax.swing.JTextField tfLogradouro;
    private javax.swing.JTextField tfNome_dono;
    private javax.swing.JTextField tfNome_resp;
    private javax.swing.JTextField tfNumero;
    // End of variables declaration//GEN-END:variables

    private void limparCampos() {
        tfNome_resp.setText("");
        tfCPF_resp.setText("");
        tfNome_dono.setText("");
        tfData_dono.setText("");
        tfLogradouro.setText("");
        tfNumero.setText("");
        tfComplemento.setText("");
        tfBairro.setText("");
        tfCep.setText("");
        tfCidade.setText("");
    }
}
